package s18.ch21.ex1;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class MySerialization {

	public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {
	
//		Truck truck = new Truck();
//		truck.setBrand("Chevrolet");
//		truck.setCapacity(666);
//		
//		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("car.out"));
//		
//		oos.writeObject(truck);
//		
//		oos.close();
		
		ObjectInputStream ois = new ObjectInputStream(new FileInputStream("car.out"));
		
		Truck truck1 = (Truck) ois.readObject();
		ois.close();
		
		System.out.println(truck1.getBrand());
		System.out.println(truck1.getCapacity());
		
		
	}
}
